<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=10" />
    <title>测试</title>
    <script src="../../static/uiplug/layui/layui.all.js" type="text/javascript"></script>
    <script src="../../static/uiplug/jquery/jquery-3.0.0.min.js" type="text/javascript"></script>
    <link rel="stylesheet" href="../../static/uiplug/layui/css/layui.css" type="text/css" />
    <link rel="stylesheet" href="../../static/uiplug/define/css/css.css">
</head>
<body style=" background-color: #eee">

<input type=file id='f1' id="upload"  name="myfile" /> <br />

<table style="">
        <tr>
            <td><h2>detail:</h2></td>
            <td><h2  id="textarea" ></h2></td>
        </tr>
        <tr>
            <td> <h2>ID:</h2></td>
            <td><h2  id="ID" ></h2></td>
        </tr>

    </table>
    <script type="text/javascript">
        console.log(window.ActiveXObject)
        var xmlhttpp;
        if (window.XMLHttpRequest){
            xmlhttpp=new XMLHttpRequest();
        }else{
            xmlhttpp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        var s=xmlhttpp.GetFile("C:\\IDCardPhoto\\wz.txt");
        s=s.OpenAsTextStream(ForReading,TristateUseDefault).ReadLine();
console.log(s)

        function initText(){

            //文件路径
            var selectedFile = document.getElementById("upload").files[0];
            //这是核心！！读取操作都是由它完成的
            var reader = new FileReader();
            reader.readAsText(selectedFile,'gb2312');
            reader.onload = function(Event){
                //读取完毕从中取值
                var pointsTxt = Event.target.result;
                var result = pointsTxt.replace(/\s*/g,"");
                //转为数组获取指定参数
                result = result.split(',');
                document.getElementById("textarea").innerHTML=result;
                document.getElementById("ID").innerHTML=result[5];
                console.log(pointsTxt)
            }
        }
    </script>

</body>
</html>